package 质因数;

import java.util.Random;
import java.util.Scanner;

/**
 * @author Administrator
 * @ClassName PrimeFactor
 * @TIME 星期五 2020/12/25
 */
public class PrimeFactor extends Thread {
    public static void main(String[] args) {
        PrimeFactor p = new PrimeFactor();
        p.start();
    }

    @Override
    public void run() {
        long start = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        Random rd = new Random();
        System.out.println("输入一个整数,转为质因数");
        int scInt = sc.nextInt();

        for (; true;) {
            int num1 = rd.nextInt(100);
            int num2 = rd.nextInt(100);
            int num3 = rd.nextInt(100);
            int num4 = rd.nextInt(100);
            System.out.println(num1);
            System.out.println(num2);
            System.out.println(num3);
            System.out.println(num4);
            if (scInt == num1 * num2 * num3 * num4 && num1 != 1 && num2 != 1 && num3 != 1 && num4 != 1) {
                System.out.println(scInt + "=" + num1 + "*" + num2 + "*" + num3 + "*" + num4);
                break;
            }
        }
        long stop = System.currentTimeMillis();
        System.out.println("运行时间 " + (stop - start) + "ms");
    }
}
